<template>
	<view class="row" v-for="(itme,index) in list">
		<view class="newsbox">
			<view class="pic">
				<image :src="item.picurl" mode="aspectFill"></image>
			</view>
			<view class="text">
				<view class="title">
					{{item.title}}
				</view>
				<view class="info" v-if="!item.looktime">
					<text>{{item.author}}</text>
					<text>{{item.hits}}</text>
				</view>
				<view class="info" v-else>
					<text>浏览时间 {{item.looktime}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"Newsbox",
		props:{
			list:[
				{
					title:'组件默认标题',
					author:'张三',
					hits:443,
					picurl:'../../static/logo.png',
					looktime:'2024-01-30 12:12:22'
				},{
					title:'组件默认标题2',
					author:'张三2',
					hits:443,
					picurl:'../../static/logo.png',
					looktime:'2024-01-30 12:12:22'
				},{
					title:'组件默认标题3',
					author:'张三3',
					hits:443,
					picurl:'../../static/logo.png',
					looktime:'2024-01-30 12:12:22'
				},
			]
			item:{
				type:Object,
				default(){
					return {
						title:'组件默认标题',
						author:'张三',
						hits:443,
						picurl:'../../static/logo.png',
						looktime:'2024-01-30 12:12:22'
					}
				}
			}
		},
		data() {
			return {
				
				
			};
		}
	}
</script>

<style lang="scss">
	.newsbox{
		display: flex;
		.pic{
			width: 230rpx;
			height: 160rpx;
			image{
				height: 100%;
				width: 100%;
			}
		}
		
		.text{
			// border: 1px solid red;
			flex: 1;
			padding-left: 20rpx;
			display: flex;
			
			flex-direction: column;			//同级标签列   排列
			justify-content: space-between;	//内容垂直在上下
			
			
			.title{
				font-size: 30rpx;
				color: #333;
				
				text-overflow: -o-ellipsis-lastline;
				overflow: hidden;			//溢出内容隐藏
				text-overflow: ellipsis;	//文本溢出部分省略号表示
				display: -webkit-box;		//特别显示模式
				-webkit-line-clamp: 2;		//行数
				line-clamp: 2;
				-webkit-box-orient: vertical;//盒子中内容竖直排列
			}
			.info{
				font-size: 26rpx;
				color:#999;
				text{
					padding-right: 30rpx;
				}
			}
		}
	}
	
	

</style>